package com.hundredhealth.rose.task;

import com.hundredhealth.rose.HealthLabelApp;
import com.hundredhealth.rose.model.PrintLabel;
import com.hundredhealth.rose.util.ExecutionListener;
import com.hundredhealth.rose.util.Prints;

/**
 * Created by huazhong on 26/5/2017.
 */

public class TaskPrint implements Runnable {
    private PrintLabel printLabel;
    private ExecutionListener<Boolean> executionListener;

    public TaskPrint(PrintLabel printLabel, ExecutionListener<Boolean> executionListener) {
        this.printLabel = printLabel;
        this.executionListener = executionListener;
    }

    @Override
    public void run() {
        final boolean bPrintResult = Prints.PrintTicket(printLabel, HealthLabelApp.PRINT_WIDTH, HealthLabelApp.PRINT_HEIGHT);
        if (executionListener != null) {
            executionListener.executed(bPrintResult, null);
        }
    }
}